<template>
	<text class="iconfont" :style="{ color, 'fontSize': size }">{{ code }}</text>
</template>

<script>
	import fontPath from "@/static/iconfont.ttf"
	export default {
		name: "u-icon",
		props: {
			code: {
				type: String,
				required: true
			},
			color: {
				type: String,
				default: 'black'
			},
			size: {
				type: String,
				default: '25px'
			}
		},
		mounted() {
			uni.loadFontFace({
				global: false,
				source: fontPath,
				family: 'iconfont'
			})
		},
	}
</script>

<style>
	.iconfont {
		font-family: iconfont;
	}
</style>